﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using ESRI.ArcGIS.Geometry;

namespace hzGis.service.impl
{
   public class GeometryService
    {
       public static IPolyline createPolyline(List<Point> points)
       {
           object o = Type.Missing;
           ISegmentCollection segments = new Path() as ISegmentCollection;
           
           for (int i = 0; i < points.Count - 1; i++)
           {
               ILine pLine = new Line();
               pLine.PutCoords(points[i], points[i + 1]);
               ISegment pSegment = pLine as ISegment;
               segments.AddSegment(pSegment, ref o, ref o);
           }

           IGeometryCollection pPolyline = new Polyline() as IGeometryCollection;
           pPolyline.AddGeometry(segments as IGeometry, ref o, ref o);
           IPolyline pPLine = pPolyline as IPolyline;
           return pPLine;
       }
    }
}
